﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DevExpress.Xpf.Core;
using DevExpress.Xpf.Ribbon;
using ThanNhanTao.Server;
using ThanNhanTao.CommonControl;


namespace ThanNhanTao
{
    /// <summary>
    /// Interaction logic for frmNhapSoChayThan.xaml
    /// </summary>
    public partial class frmNhapSoChayThan : DXRibbonWindow
    {
        bool chay = false;
        public frmNhapSoChayThan()
        {
            InitializeComponent();
            chay = false;
        }
        public frmNhapSoChayThan(string benhNhanTam)
        {
            InitializeComponent();
            lblThongTin.Text=benhNhanTam + " - lần chạy thứ \n (Nếu không thây đổi mặc định là lần chạy thứ 1) ";
        }
        private void buttonLuu_Click(object sender, RoutedEventArgs e)
        {
            if(!string.IsNullOrEmpty(txtSoLanChay.Text.Trim()))
            {
                ThanNhanTaoGlobal.NumBerSoLanChayThan = int.Parse(txtSoLanChay.Text.Trim());
            }
            chay = true;
            this.Close();
        }

        private void DXRibbonWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if(chay==false)
            {
                ThanNhanTaoGlobal.NumBerSoLanChayThan = -2;
            }
        }
        
    }
}
